import { i18n, toI18nName } from 'boot/i18n.js'
import { AGVTypes, yesOrNo } from 'src/enum/index.js'

export const formatColumns = (deviceType = '', AGVBrands) => {
  return [{
    label: `${i18n.t('AGVCore.AGVModel')}`, field: 'deviceName'
  }, {
    label: `${i18n.t('AGVCore.AGVType')}`, field: 'deviceType', options: AGVTypes.value
  }, {
    label: `${i18n.t('AGVCore.AGVBrand')}`, field: 'agvBrandCode', options: AGVBrands,
    props: { label: `${toI18nName('agvBrandNameZhCn')}`, value: 'agvBrandCode' }
  }, {
    label: `${i18n.t('Misc.Length')}`, field: 'deviceLength', unit: 'mm'
  }, {
    label: `${i18n.t('Misc.Width')}`, field: 'deviceWidth', unit: 'mm'
  }, {
    label: `${i18n.t('Misc.Height')}`, field: 'deviceHeight', unit: 'mm'
  }, {
    label: `${i18n.t('AGVCore.RotationDiameterS')}`, field: 'deviceRotaDia', unit: 'mm',
    display: ['10', '20', '40'].includes(deviceType)
  }, {
    label: `${i18n.t('IsEnable')}`, field: 'isEnable', options: yesOrNo.value, useTag: true
  }, {
    label: `${i18n.t('AGVCore.IsOmni')}`, field: 'deviceDirType', options: yesOrNo.value, useTag: true
  }, {
    label: `${i18n.t('AGVCore.QuadrantControl')}`, field: 'deviceBarrier', options: yesOrNo.value,
    useTag: true
  }, {
    label: `${i18n.t('AGVCore.RollsRows')}`, field: 'yzDeviceTypeLayerNum',
    display: ['20'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.RollsCols')}`, field: 'yzDeviceTypeColNum',
    display: ['20'].includes(deviceType)
  }, {
    label: `${i18n.t('Misc.StorageGridCols')}`, field: 'ctuDeviceTypeShelfNum',
    display: ['40'].includes(deviceType)
  }, {
    label: `${i18n.t('Misc.StorageGridLayers')}`, field: 'ctuDeviceTypeLayerNum',
    display: ['40'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.PreactionMode')}`, field: 'ctuDeviceTypeHeadMode',
    display: ['40'].includes(deviceType)
  }, {
    label: `${i18n.t('Misc.OffSet')}`, field: 'ctuDeviceTypeOffset', unit: 'mm',
    display: ['40'].includes(deviceType)
  }, {
    label: `${i18n.t('Misc.OffSet')}`, field: 'yzDeviceTypeRollOffset', unit: 'mm',
    display: ['20'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.LiftOffSet')}`, field: 'ccDeviceTypeLiftOffset', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.ForkliftType')}`, field: 'ccDeviceTypeForkType',
    options: [{
      label: `${i18n.t('AGVCore.ForkliftTypeTip1')}`, value: '1'
    }, {
      label: `${i18n.t('AGVCore.ForkliftTypeTip2')}`, value: '40'
    }], display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.PreliftHeight')}`, field: 'ccDeviceTypeForkSafeHeight', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.DistanceTip1')}`, field: 'ccDeviceTypeChargeToCenter', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.DistanceTip2')}`, field: 'ccDeviceTypeForkWheel', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.DistanceTip3')}`, field: 'ccDeviceTypeForkLengthCenter', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.ProngTip1')}`, field: 'ccDeviceTypeForkProngMinHeight', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.ProngTip2')}`, field: 'ccDeviceTypeForkRunEmpHeight', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.ProngTip3')}`, field: 'ccDeviceTypeForkRunFullHeight', unit: 'mm',
    display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.ReleaseCargoTip1')}`, field: 'ccDeviceTypeForkPutOutStorage', options: yesOrNo.value,
    useTag: true, display: ['30'].includes(deviceType)
  }, {
    label: `${i18n.t('Misc.ShelfPickupTime')}`, field: 'ctuDeviceTypeShelvesTime', unit: 's',
    display: ['40'].includes(deviceType)
  }, {
    label: `${i18n.t('Misc.StorageGridPickupTime')}`, field: 'ctuDeviceTypeStorageTime', unit: 's',
    display: ['40'].includes(deviceType)
  }, {
    label: `${i18n.t('AGVCore.DistanceTip4')}`, field: 'ctuDeviceTypeWheel', unit: 'mm',
    display: ['40'].includes(deviceType)
  }, {
    label: `${i18n.t('Misc.ActuatorHandling')}`, field: 'ctuDeviceTypeActuator', options: yesOrNo.value,
    useTag: true, display: ['40'].includes(deviceType)
  }].filter(el => el.display !== false)
}